﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GEPSCodeTemplate
{
    public partial class ParamDisplayFrame : UserControl
    {
        private Param _param;

        private Action<ParamDisplayFrame, Param> _TextChanged;
        public Action<ParamDisplayFrame, Param> TextChanged
        {
            private get { return _TextChanged; }
            set { _TextChanged = value;}
        }

        private ParamDisplayFrame()
        {
            InitializeComponent();
        } 

        public ParamDisplayFrame(Param param):this()
        {
            _param = param;
            txtName.Text = param.Name;
            txtValue.Text = param.Value;
            txtDescripe.Text = param.Descripe;
        }

        private void txtValue_TextChanged(object sender, EventArgs e)
        {
            if (TextChanged != null)
            {
                _param.Value = txtValue.Text;
                TextChanged(this, _param);
            }
        }

    }
}
